<?php
class AdminSubNav extends CWidget {
	public $allItems = array(
		'posts' => array(
			array(
				'title' => '编辑文章',
				'action' => array(
					'index',
					'edit'
				)
			),
			array(
				'title' => '添加新文章',
				'action' => 'postnew'
			),
			array(
				'title' => '分类目录',
				'action' => array(
					'categories',
					'categoryedit'
				)
			),
			array(
				'title' => '热门文章',
				'action' => 'hots'
			),
		),
		'slides' => array(
			array(
				'title' => '轮换图片编辑',
				'action' => 'edit'
			)
		),
		'psytest' => array(
			array(
				'title' => '心理测试管理',
				'action' => array(
                    'index',
                    'edittopic',
                    'editquestions',
                    'editquestions2',
                    'editdims',
                    'editconclusions'
                )
			),
            array(
                'title' => '心理测试分类管理',
                'action' => array(
                    'editcategories',
                    'editcategory'
                )
            ),
            array(
                'title' => '推荐心理测试',
                'action' => array(
                    'editrecommendpsytest'
                )
            )
		),
		'psychologists' => array(
			array(
				'title' => '咨询师信息管理',
				'action' => array(
					'index',
					'update'
				)
			),
			array(
				'title' => '添加咨询师',
				'action' => 'add'
			)
		),
		'qas' => array(
			array(
				'title' => '在线问吧管理',
				'action' => 'manage'
			)
		),
		'users' => array(
			array(
				'title' => '群发邮件',
				'action' => 'bulkmails'
			)
		),
		'comments' => array(
			array(
				'title' => '文章评论管理',
				'action' => 'manage'
			),
			array(
				'title' => '心理测试评论管理',
				'action' => 'psytestcommentmanage'
			)
		),
		'seo' => array(
			array(
				'title' => '友情链接管理',
				'action' => 'listlinks'
			)
		),
		'login' => array(
			array(
				'title' => '管理员登录',
				'action' => 'index'
			)
		),
		'bbs' => array(
			array(
				'title' => '论坛热帖',
				'action' => 'hot'
			),
			array(
				'title' => '心灵文学',
				'action' => 'literal'
			)
		)
	);
	public $navItems = array();
	public $itemsTitle = array(
		'posts' => '文章管理',
		'slides' => '轮换图片',
		'psytest' => '心理测试',
		'psychologists' => '咨询师信息',
		'qas' => '在线问吧管理',
		'users' => '用户管理',
		'comments' => '评论管理',
		'login' => '管理员登录',
		'bbs' => '论坛关联选项',
		'seo' => 'SEO 选项'
	);
	public $itemTitle;
	private $_module;

	public function init() {
		$this->_module = basename($this->controller->id);
		$this->itemTitle = $this->itemsTitle[$this->_module];
		$this->navItems = $this->allItems[$this->_module];
	}
	
	public function run() {
		$this->renderContent();
	}
	
	public function renderContent() {
		$this->render('adminSubNav', array(
				'navItems' => $this->navItems, 
				'itemTitle' => $this->itemTitle
			)
		);
	}
}
